package com.yanyu.space.member.config;

import cn.dev33.satoken.router.SaRouteFunction;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.stp.StpUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yanyu
 */
@Configuration
public class SaTokenConfig {
    @Bean
    public SaRouteFunction saRouteFunction() {
        return (request, response, handler) -> {
            SaRouter.match("/sys/captchaImage", "/sys/login").stop()
                    .match("/test/**").stop()
                    .match("/member/**").check(() -> StpUtil.checkLogin());
        };
    }
}
